<template>
  <div class="test" v-loading="iLoading">
    <!-- <el-card class="box-card" shadow="navor">
      <el-row :gutter="12">
      <el-col :span="8">
        <el-card shadow="hover"> id : {{ userInfo.uid }} </el-card>
      </el-col>
      <el-col :span="8">
        <el-card shadow="hover"> 姓名 : {{ userInfo.uname }} </el-card>
      </el-col>
      <el-col :span="8">
        <el-card shadow="hover"> 班级 : {{ userInfo.className }} </el-card>
      </el-col>
    </el-row>
    <el-row :gutter="12">
      <el-col :span="8">
        <el-card shadow="hover"> 学院 : {{ userInfo.collegeName }} </el-card>
      </el-col>
      <el-col :span="8">
        <el-card shadow="hover"> 专业 : {{ userInfo.majorName }} </el-card>
      </el-col>
      <el-col :span="8">
        <el-card shadow="hover"> 学业绩点 : {{ userInfo.gpa }} </el-card>
      </el-col>

    </el-row>
    <el-row :gutter="12">
      <el-col :span="8">
        <el-card shadow="hover"> 加分绩点 : {{ userInfo.addGpa }} </el-card>
      </el-col>
      <el-col :span="8">
        <el-card shadow="hover"> 总绩点 : {{ userInfo.totalGpa }} </el-card>
      </el-col>
      
    </el-row>

    </el-card> -->

    <el-card class="box">
      <h3 style="text-align: center;">{{ year }}年学生信息</h3>
      <div class="box-item">
        <div>头像</div>
        <div>
          <el-avatar :src="userInfo.avatar"></el-avatar>
        </div>
      </div>
      <div class="box-item">
        <div>姓名</div>
        <div>{{ userInfo.uname }}</div>
      </div>
      <div class="box-item">
        <div>学号</div>
        <div>{{ userInfo.uaccount }}</div>
      </div>
      <div class="box-item">
        <div>性别</div>
        <div>{{ userInfo.sex == 1 ? '男' : '女' }}</div>
      </div>
      <div class="box-item">
        <div>班级</div>
        <div>{{ userInfo.className }}</div>
      </div>
      <div class="box-item">
        <div>学院</div>
        <div>{{ userInfo.collegeName }}</div>
      </div>
      <div class="box-item">
        <div>学业绩点</div>
        <div>{{ userInfo.gpa }}</div>
      </div>
      <div class="box-item">
        <div>加分绩点</div>
        <div>{{ userInfo.addGpa }}</div>
      </div>
      <div class="box-item">
        <div>总绩点</div>
        <div>{{ userInfo.totalGpa }}</div>
      </div>

    </el-card>
  </div>
</template>

<script>
import { getUserInfo } from "@/api/student";
export default {
  name: "stu-apply",
  data() {
    return {
      iLoading: false,
      userInfo: {
        // uID: 132456,
        // className: "软件216",
        // major: "软件工程",
        // collegeName: "计算机学院",
        // gpa: 3.50,
        // addGpa: 1.50,
        // totalGpa: 5.00,
        // createTime: "2023-08-25",
        // uName : "李俊熙"
      },
      year: new Date().getFullYear()
    }
  },
  created() {
    this.init();
  },
  methods: {
    init() {
      this.iLoading = true
      getUserInfo().then(res => {
        this.userInfo = res.data
        this.iLoading = false
      }).catch(err => {
        this.iLoading = false
      })
    }
  },
};
</script>

<style scoped>
.test {
  height: 100%;
  padding: 40px;
}

.box-card {
  margin: 10px auto;
  padding: 20px;
  height: 630px;
  /* width: 80%; */
}

.el-row {
  margin-bottom: 20px;
  /* &:last-child {
      margin-bottom: 0;
    } */
}

.box {
  margin: 0 auto;
  width: 40%;
}

.box-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
</style>